define(function(require, exports, module) {
	'use strict';
    
    var rk = require('rk');
    require('../../../xsyBase');

    $.widget('rk.xsySuDetail', $.rk.xsyBase, {
        _create: function(){
            var me = this;
            var elem = me.element;
            var opt = me.options;

            var tpl = require('./widget.tpl');
            var html = rk.templateText(tpl, opt);
            elem.html(html);

            me._initChildren();

            me._listenOuterEvent('crmHeaderFloating', function(info){//crm容器的纵向滚动事件
                var dhead = $('[ data-layout="detail-header"]');
                if(dhead.hasClass('xsy_su_header_fold') || dhead.hasClass('xsy_su_header_fold_menu_fold')){
                    elem.find('.xsy_detail_body:first').css({
                        marginTop: info.height + 100
                    });
                }
            });
            me._listenOuterEvent('crmHeaderUnFloating', function(info){//crm容器的纵向滚动事件
                elem.find('.xsy_detail_body:first').css({
                    marginTop: 0
                });
            });

        }
    });
});